package com.gfxy.educational.service;

import com.gfxy.educational.dao.EduGradeMapper;
import com.gfxy.educational.entity.EduGrade;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: lijixin 2019-06-04
 */
@Service
public class GradeService {
    private static final Logger logger = LoggerFactory.getLogger(GradeService.class);

    @Autowired
    private EduGradeMapper gradeMapper;

    public List<EduGrade> getAllGrade(){
        logger.debug("查询所有的年级信息");
        List<EduGrade> grades = gradeMapper.selectByExample(null);
        return grades;
    }

    public int saveGrade(EduGrade grade) {

        return gradeMapper.insert(grade);
    }

    public int updateGrade(EduGrade grade) {
        return gradeMapper.updateByPrimaryKeySelective(grade);
    }

    public int deleteGrade(String gradeId) {
        return gradeMapper.deleteByPrimaryKey(gradeId);
    }
}
